1 Title: MultiMarkdown User's Guide
2 Subtitle: Version 2.0.b5
3 Author: Fletcher T. Penney
4 Web: http://fletcherpenney.net/
5 Copyright: 2005-2008 Fletcher T. Penney.
6 This work is licensed under a Creative Commons License.
7 http://creativecommons.org/licenses/by-nc-sa/3.0/
8 XMP: CCAttributionShareAlike
21 Revision: $Id: MultiMarkdown User's Guide.md 497 2008-03-23 12:53:40Z fletcher $
23 CSS: http://fletcherpenney.net/document.css
24 XHTML XSLT: xhtml-toc-h2.xslt
26 # Introduction to MultiMarkdown #
28 This document is an introduction to [MultiMarkdown][] --- what it is, how to
29 use it, how you can help make it better. This document exists in multiple
30 formats: a wiki page, a plain text document, a pdf, a [Scrivener][] document,
31 etc. Find the format that best suits your needs, or create your own. That is
32 what MultiMarkdown was designed to be used for!
35 [MultiMarkdown]: http://fletcherpenney.net/MultiMarkdown
36 [Scrivener]: http://www.literatureandlatte.com/scrivener.html
38 ## What is Markdown? ##
40 To understand what MultiMarkdown is, you first should be familiar with
41 [Markdown](http://daringfireball.net/projects/markdown/ "Daring Fireball:
42 Markdown"). The best description of what Markdown is comes from John Gruber's
45 > Markdown is a text-to-HTML conversion tool for web writers. Markdown
46 > allows you to write using an easy-to-read, easy-to-write plain text
47 > format, then convert it to structurally valid XHTML (or HTML).
49 > Thus, “Markdown” is two things: (1) a plain text formatting
50 > syntax; and (2) a software tool, written in Perl, that converts
51 > the plain text formatting to HTML. See the Syntax page for details
52 > pertaining to Markdown’s formatting syntax. You can try it out,
53 > right now, using the online Dingus.
55 > The overriding design goal for Markdown’s formatting syntax is to
56 > make it as readable as possible. The idea is that a Markdown-formatted
57 > document should be publishable as-is, as plain text, without looking
58 > like it’s been marked up with tags or formatting instructions. While
59 > Markdown’s syntax has been influenced by several existing
60 > text-to-HTML filters, the single biggest source of inspiration for
61 > Markdown’s syntax is the format of plain text email. [#Gruber][]
65 [#Gruber]: Daring Fireball: Markdown.
66 <http://daringfireball.net/projects/markdown/>
68 ## What is MultiMarkdown? ##
70 Markdown is great, but it lacked a few features that would allow it to work
71 with documents, rather than just pieces of a web page.
73 I wrote MultiMarkdown in order to leverage Markdown's syntax, but to extend it
74 to work with complete documents that could ultimately be converted from text
75 into other formats, including complete XHTML documents, LaTeX, PDF, RTF, or
76 even (shudder) Microsoft Word documents.
78 In addition to the ability to work with complete documents and conversion to
79 other formats, the Markdown syntax was lacking a few things. Michel Fortin
80 added a few additional syntax tools when writing [PHP Markdown Extra][]. Some
81 of his ideas were implemented and expanded on in MultiMarkdown.
83 John Gruber may disagree with me, but I really did try to stick with his
84 proclaimed vision whenever I added a new syntax format to MultiMarkdown. The
85 quality that attracted me to Markdown the most was its clean format. Reading a
86 plain text document written in Markdown is *easy*. It makes sense, and it
87 looks like it was designed for people, not computers. To the extent possible,
88 I tried to keep this same concept in mind when working on MultiMarkdown.
90 I may or may not have succeeded in this...
92 In the vein of Markdown's multiple definitions, you can think of MultiMarkdown
95 1. A perl script to convert plain text to XHTML
97 2. The syntax used in the plain text to describe how to convert it to XHTML
99 3. The system of programs (perl scripts, shell commands, XSLT transforms, php scripts, etc) used to convert plain text to XHTML, and then to convert XHTML into LaTeX, PDF, RTF, etc)
101 [PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
103 ## How do I use MultiMarkdown? ##
105 You can use MultiMarkdown in a variety of ways:
107 * As a command-line perl program (the "default" approach)
109 * As a drag and drop application for Mac OS X
112 [bundle](http://files.fletcherpenney.net/MultiMarkdown.tmbundle.zip)
114 * Within the [Scrivener][] application
116 * In a [blosxom][] or [Oddmuse][] web site
118 [TextMate]: http://macromates.com/
119 [Scrivener]: http://www.literatureandlatte.com/scrivener.html
120 [blosxom]: http://blosxom.sourceforge.net
121 [Oddmuse]: http://oddmuse.org/ "Oddmuse"
123 ## Where can I find MultiMarkdown? ##
125 The MultiMarkdown package can be downloaded:
127 * <http://files.fletcherpenney.net/MultiMarkdown.zip>
129 Information about MultiMarkdown is available on my web site:
131 * <http://fletcherpenney.net/MultiMarkdown>
133 John Gruber's original Markdown is available at his site:
135 * <http://daringfireball.net/projects/markdown/>
137 Michel Fortin's PHP version of Markdown is at his site:
139 * <http://www.michelf.com/projects/php-markdown/>
142 ## Where can I get more information about MultiMarkdown?##
144 As above, check my web site.
146 Also, you can check out the MultiMarkdown discussion list:
148 * <http://groups.google.com/group/multimarkdown/>
149 * <mailto:multimarkdown@googlegroups.com>
151 If you questions are specific to Scrivener, you can also browse the Literate and Latte forum:
153 * <http://www.literatureandlatte.com/forum/>
155 # Quickstart Guide to MultiMarkdown #
157 Quick start instructions, for those in a hurry...
159 ## General Instructions ##
161 1. Download the MultiMarkdown package:
163 <http://files.fletcherpenney.net/MultiMarkdown.zip>
167 3. In the "bin" directory, there are a couple of perl scripts designed to take a MultiMarkdown text file and convert to XHTML, RTF, or LaTeX:
169 * multimarkdown2XHTML.pl
171 * multimarkdown2latex.pl
173 * multimarkdown2RTF.pl
175 4. To use these files, do something like the following:
178 bin/multimarkdown2XHTML.pl file.txt > file.html
180 where "file.txt" is the MultiMarkdown file you wish to process.
182 5. You can now open `file.html` in your web browser, or do what you like with it.
184 ## "Common Installation" Instructions for OS X ##
187 1. Download the MultiMarkdown package:
189 <http://files.fletcherpenney.net/MultiMarkdown.zip>
193 3. Move the unzipped directory to the appropriate place:
195 * `/Library/Application Support/MultiMarkdown`
196 * `~/Library/Application Support/MultiMarkdown`
198 4. Use your application as usual (e.g. [TextMate][], [Scrivener][], the MultiMarkdown [Drag and Drop](http://fletcherpenney.net/MultiMarkdown_Drag_and_Drop) utilities)
200 ## Command-Line Shortcuts ##
203 * The perl scripts above look for certain utility files in certain places. It
204 is important to preserve the directory structure of the various files
205 included in the MultiMarkdown package.
207 * Because of this, symlinks don't seem to work well. Aliases do, however. For
208 example, in tcsh, you can add the following to your .tcshrc file (similar
209 features should exist for other shells)
211 alias mmd '/Path/To/MultiMarkdown/bin/multimarkdown2XHTML.pl'
212 alias mmd2tex '/Path/To/MultiMarkdown/bin/multimarkdown2latex.pl'
214 Then, you could do something like this:
216 mmd file.txt > file.html
218 [TextMate]: http://macromates.com/
219 [Scrivener]: http://www.literatureandlatte.com/scrivener.html
221 # MultiMarkdown Syntax Guide #
223 This is a guide to the markup syntax used in the MultiMarkdown system.
227 MultiMarkdown has support for metadata, meaning that you can include
228 information about a document that is not necessarily part of the document
231 To use metadata, simply add information to the top of a Markdown file:
233 Title: A New MultiMarkdown Document
234 Author: Fletcher T. Penney
238 The key is the text before the colon, and the data is the text after the
239 colon. In the above example, notice that there are two lines of information
240 for the Author key. If you end a line with "space-space-newline", the newline
241 will be included when converted to other formats.
243 There must not be any whitespace above the metadata, and the metadata block
244 ends with the first whitespace only line. The metadata is stripped from the
245 document before it is passed on to the syntax parser.
247 While not required, I recommend including two spaces at the end of each line
248 of metadata. In this way, if you pass your document through a regular version
249 of Markdown, the metadata will be properly formatted as plain text with line
250 breaks, rather than joined into a single run-on paragraph.
252 I have included information about some of the "standard" metadata keys --- I
253 welcome feedback and suggestions for additional standard keys that would be
254 useful. If you add keys that are not listed, they are included in the XHTML
255 and LaTeX as custom variables that can still be used if you desire.
257 Remember, XHTML snippets have no means to use metadata. To make use of these
258 features, one must be using `Format: complete` to create full XHTML documents,
259 which can then be processed using XSLT to create other document types. As an
260 example, I use metadata for information that is used to add title, author,
261 keyword, and copyright metadata to PDF's created by MultiMarkdown.
263 **Note**: I make multiple mentions to the use of these keys for LaTeX
264 documents. This is simply because the LaTeX output format currently makes the
265 most use of the metadata information. Any export format could be modified to
266 make use of additional metadata keys.
270 Use this to include the author's mailing address. You can have more than one
271 line in this field --- use two extra spaces at the end of a line, and a
272 newline character will be used in LaTeX. Also used as return address for
273 letterhead and envelope templates.
277 Self-explanatory. I strip this out to provide an author string to LaTeX
278 documents. Also used as the sender for letterhead and envelope templates.
283 Use this to include an organization that the author is affiliated with, e.g. a
284 university, company, or organization. You can include address information here
285 as well, or use the `Address`, `email`, `web`, and `phone` metadata fields.
286 You can have more than one line in this field --- use two extra spaces at the
287 end of the line, and a newline character will be used in LaTeX.
290 ### Base Header Level ###
292 Used by my XSLT script tool to change the default header level. For example,
293 if using the memoir class, you might want a first level header to be
294 interpreted as a chapter, rather than as a part. To do this, simply set `Base
295 Header Level` to `2`.
299 Set to the base part of a url to be used for `WikiLinks` and `[[Free Links]]`.
300 See [WikiLinks][] for more information.
303 ### Bibliography Title ###
305 Change the title used for the references section (e.g. "References" or
306 "Bibliography"). The default value is "Bibliography".
309 ### Bibliography Style ###
311 The name of the BibTeX style you wish to use.
316 This should be the name of a `.bib` file (a BibTeX file used to store
317 references). If you use my xhtml2latex.xslt file, this will convert external
318 citations into markup for BibTeX (see [Bibliography Support][] for more
321 You must have `bibtex` installed and working, and the `.bib` file must be in
322 your working directory.
326 This is used to designate the `chapterstyle` in LaTeX memoir documents.
330 This can be used to provide a copyright string.
335 Used to specify a CSS stylesheet when creating the complete XHTML output.
340 Provide a date for the document.
345 Use this to include the author's email address.
349 Set to `complete` to indicate that a fully-formed XHTML document should be
350 produced. Such a document is ready for processing by an XSLT tool, such as the
351 XSLT files to convert XHTML into LaTeX.
353 **Note**: Some MultiMarkdown tools add this for you (e.g. TextMate using my
354 bundle, and Scrivener.) Duplicating the `Format` key in these programs will
359 Provide a list of keywords for the document. I use these to add keywords to
360 PDF's that are produced as well. Keywords can be separated by commas, or
361 placed on separate lines.
366 Currently, the language field is used to specify which version of
367 [SmartyPants] to use. In the future, it may be used for other purposes as
370 The languages are written using the English word (e.g. "german" not
373 [SmartyPants]: http://daringfireball.net/projects/smartypants/ "SmartyPants Homepage"
378 Used to designate an XSLT file to convert an XHTML document to a LaTeX
379 document. The LaTeX document can then be converted to PDF by `pdflatex`. This
380 key used to be called `XSLT File`.
384 This is used to designate the `pagestyle` in LaTeX memoir documents.
388 Use this to include the author's phone number(s). You can have more than one
389 line in this field --- use two extra spaces at the end of the line, and a
390 newline character will be used in LaTeX.
395 Used by letterhead and envelope templates.
398 ### Recipient Address ###
400 Used by letterhead and envelope templates.
405 You can use a string to declare the current version of the document. Displayed
406 on the copyright page when using my memoir XSLT transform.
411 This key is used to provide an XSLT file that can alter the XHTML output prior
412 to conversion to RTF. Useful for further customizing the output of
413 MultiMarkdown specifically for the RTF format. I have no plans to create any
414 such files myself, but others may find it useful.
418 Used to provide a subtitle. It ends up in the meta tags, but can be extracted
419 by XSLT for other uses.
424 Used to provide the official title of a document. This is set as the `<title>`
425 string within the `<head>` section of an HTML document, and is also used by
426 other export formats.
429 ### Use WikiLinks ###
431 Set to `true` or `1` to enable the use of `WikiWords` and `[[Free Links]]`.
432 Requires that you also set `Base URL`. See [WikiLinks][] for more information.
437 Use this to include the author's web URL.
442 This is used to include raw XHTML information in the header of a document. You
443 can use this field to add information that will be included in the header of
444 the generated XHTML file. This can be CSS formatting data, or javascript code,
445 or just about anything. I am not responsible for getting that code to work.
446 MultiMarkdown just includes it as is.
448 Anything included in this field is inserted, unaltered, in the `<head>`
449 section of the XHTML output. If you do add anything here, the XSLT stylesheet
450 may have to updated to ignore what you added if you want to convert to LaTeX.
451 Let me know what you add, and I can consider updating the XSLT stylesheet to
452 ignore it. Currently it ignores `<style>` sections.
457 This is the name of the XSLT file to use to post-process the XHTML file. This
458 can be used to further customize the XHTML output generated by MultiMarkdown.
459 For example, the `xhtml-toc.xslt` file can add a Table of Contents to the
466 This is used to provide a file to be included using
467 [xmpincl](http://www.ctan.org/tex-archive/macros/latex/contrib/xmpincl/).
468 Basically, this adds the ability to provide Creative Commons Licensing
469 information in a PDF's [metadata](http://creativecommons.org/technology/xmp).
470 It can also be used for other purposes (beyond the scope of this document.)
473 ### XSLT File (deprecated)###
475 This metadata key has been deprecated in favor of `XHTML XSLT`, `RTF XSLT`,
478 ## Automatic Cross-References ##
480 An oft-requested feature was the ability to have Markdown automatically handle
481 within-document links as easily as it handled external links. To this aim, I
482 added the ability to interpret `[Some Text][]` as a cross-link, if a header
483 named "Some Text" exists.
485 As an example, `[Introduction to MultiMarkdown][]` will take you to [the
486 Introduction][Introduction to MultiMarkdown].
488 Alternatively, you can include an optional label of your choosing to help
489 disambiguate cases where multiple headers have the same title:
491 ### Overview [MultiMarkdownOverview] ##
493 This allows you to use `[MultiMarkdownOverview]` to refer to this section
494 specifically, and not another section named `Overview`. This works with atx-
495 or settext-style headers.
497 If you have already defined an anchor using the same id that is used by a
498 header, then the defined anchor takes precedence.
500 In addition to headers within the document, you can provide labels for images
501 and tables which can then be used for cross-references as well.
505 Obviously, images are handled just fine by Markdown (with the exception of
506 attributes as noted above.) However, without some more information, images are
507 not easily translated into other document formats (e.g. PDF).
509 To handle this, my XSLT files will make use of `<img>` dimensions (e.g.
510 `height` and `width`). If present, the image will be scaled. If only one
511 dimension is specified, the image will be scaled proportionately. If neither
512 `height` nor `width` is specified, then the image will be scaled such that
513 it's width is the same as a column of text. This is to prevent high resolution
514 images from overflowing the page. Unfortunately, it has the side effect of
515 "zooming" in on smaller images. So, if you have images that are being scaled
516 in a way that you do not desire, simply specify at least one dimension.
518 *Note: XHTML only allows for units of `px` and `%` on `<img>` tags. LaTeX
519 allows for several others. So, my XSLT file allows for other units to be used,
520 even if they screw up the XHTML version. You have to choose appropriate units
521 for your purpose. Unfortunately, the only way around this is to make sure that
522 all of your images contain actual dimension information, and then remove the
523 `\resizebox` part from the XSLT.*
525 ## Anchor and Image Attributes ##
527 Adding attributes to links and images has been requested for a long time on
528 the Markdown discussion list. I was fairly opposed to this, as most of the
529 proposals really disrupted the readability of the syntax. I consider myself a
530 "Markdown purist", meaning that I took John's introduction to heart:
532 > The overriding design goal for Markdown's formatting syntax is to make
533 > it as readable as possible. The idea is that a Markdown-formatted
534 > document should be publishable as-is, as plain text, without looking
535 > like it's been marked up with tags or formatting instructions. While
536 > Markdown's syntax has been influenced by several existing text-to-HTML
537 > filters, the single biggest source of inspiration for Markdown's
538 > syntax is the format of plain text email.
540 Because there was not a syntax proposal that I felt fit this goal, I was generally opposed to the idea.
542 Then, Choan C. Gálvez [proposed][galvez] a brilliantly simple syntax that
543 stayed out of the way. By simply appending the attributes to the link
544 reference information, which is already removed from the text itself, it
545 doesn't disturb the readability.
547 [galvez]: http://six.pairlist.net/pipermail/markdown-discuss/2005-October/001578.html
551 This is a formatted ![image][] and a [link][] with attributes.
553 [image]: http://path.to/image "Image title" width=40px height=400px
554 [link]: http://path.to/link.html "Some Link" class=external
555 style="border: solid black 1px;"
557 This will generate width and height attributes for the image, and a border
558 around the link. And while it can be argued that it does look "like it's been
559 marked up with tags [and] formatting instructions", even I can't argue too
560 strongly against it. The link and the title in quotes already look like some
561 form of markup, and the the additional tags are hardly that intrusive, and
562 they offer a great deal of functionality. They might even be useful in further
563 functions (citations?).
565 The attributes must continue after the other link/image data, and may contain
566 newlines, but must start at the beginning of the line. The format is
567 `attribute=value` or `attribute="multi word value"`. Currently, MultiMarkdown
568 does not attempt to interpret or make any use of any of these attributes.
569 Also, you can't have a multiword attribute span a newline.
574 MultiMarkdown includes support for "WikiLinks" for those who are using
575 MultiMarkdown in a wiki environment, such as [Oddmuse][]. If `Use WikiLinks`
576 is set to true in the metadata, then WikiWords, such as `ThisIsAWikiWord` will
577 be used to create a link to the given page, using the `Base URL` metadata key
578 to construct the URL. Additionally, you can use what Oddmuse refers to as
579 "Free Links" --- rather than using "CamelCase" to define a link, you use
580 brackets to designate a link with multiple words, e.g. `[[This Is A Free
583 This feature is not really useful outside of a wiki environment.
585 If you are using this, and want a word that happens to look like a WikiWord to
586 be ignored, simply prepend a backslash, e.g. `\ThisIsNotAWikiWord`.
588 [Oddmuse]: http://www.oddmuse.org/ "Oddmuse Homepage"
590 **Note:** The WikiLinks feature has come to cause more trouble than it is
591 worth. It will likely be deprecated, but one can still use the wiki software
592 to manage these links. For example, my [MultiMarkdown Extension] for [Oddmuse]
593 supports Oddmuse styled WikiLinks.
595 [MultiMarkdown Extension]: http://www.oddmuse.org/cgi-bin/wiki/Markdown_Extension
600 I have added support for footnotes to MultiMarkdown, using the syntax proposed
601 by John Gruber. Note that there is no official support for footnotes yet, so
602 the output format may change, but the input format sounds fairly stable.
604 To create a footnote, enter something like the following:
606 Here is some text containing a footnote.[^somesamplefootnote]
608 [^somesamplefootnote]: Here is the text of the footnote itself.
610 [somelink]:http://somelink.com
613 The footnote itself must be at the start of a line, just like links by
614 reference. If you want a footnote to have multiple paragraphs, lists, etc.,
615 then the subsequent paragraphs need an extra tab preceding them. You may have
616 to experiment to get this just right, and please let me know of any issues you
619 This is what the final result looks like:
621 > Here is some text containing a footnote.[^somesamplefootnote]
623 [^somesamplefootnote]: Here is the text of the footnote itself.
628 I have implemented a syntax for tables similar to that used by Michael
629 Fortin's [PHP Markdown Extra][].
631 [PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra
633 Basically, it allows you to turn:
636 First Header | Second Header | Third Header |
637 ------------ | :-----------: | -----------: |
638 Content | *Long Cell* ||
639 Content | **Cell** | Cell |
641 New section | More | Data |
642 And more | And more |
645 into a [table][Prototype Table].
648 First Header | Second Header | Third Header |
649 | ---------- | :-----------: | -----------: |
650 Content | *Long Cell* ||
651 Content | **Cell** | Cell |
653 New section | More | Data |
654 And more | And more ||
658 The requirements are:
660 * There must be at least one `|` per line
661 * The second line must contain only `|`,`-`,`:`,`.`, or spaces
662 * Cell content must be on one line only
663 * Columns are separated by `|`
664 * The first line of the table, and the alignment/divider line, must start at
665 the beginning of the line
669 * It is optional whether you have `|`'s at the beginning and end of lines.
671 * To set alignment, you can use a colon to designate left or right alignment,
672 or a colon at each end to designate center alignment, as above. If no colon
673 is present, the default alignment of your system is selected (left in most
674 cases). If you use a period character (`.`), then `char` alignment is used -
675 in the future this will allow columns of decimal formatted numbers to be
676 aligned on the decimal character. Browsers do not currently support this
677 feature, so it is somewhat useless at the moment. It could be used in an
678 XSLT stylesheet for other output formats (e.g. LaTeX).
680 * To indicate that a cell should span multiple columns, there simply add
681 additional pipes (`|`) at the end of the cell, as shown in the example. If
682 the cell in question is at the end of the row, then of course that means
683 that pipes are not optional at the end of that row....
685 * You can use normal Markdown markup within the table cells.
687 * Captions are optional, but if present must be at the beginning of the line
688 immediately preceding or following the table, start with `[`, and end with
689 `]`. If you have a caption before and after the table, only the first match
692 * If you have a caption, you can also have a label, allowing you to create
693 anchors pointing to the table. If there is no label, then the caption acts
696 * Cells can be empty.
698 * You can create multiple `<tbody>` tags within a table by having a **single**
699 empty line between rows of the table. This allows your CSS to place
700 horizontal borders to emphasize different sections of the table.
702 * If there is no header for the first column, then cells in that column will
703 be treated as headers, and formatted as such.
706 ## Bibliography Support ##
708 I have included support for *basic* bibliography features in this version of
709 MultiMarkdown. Please give me feedback on ways to improve this but keep the
712 1. Bibliography support in MultiMarkdown is rudimentary. The goal is to offer
713 a basic standalone feature, that can be changed using the tool of your choice
714 to a more robust format (e.g. BibTeX, CiteProc). My XSLT files demonstrate how
715 to make this format compatible with BibTeX, but I am not planning on
716 personally providing compatibility with other tools. Feel free to post your
717 ideas and tools to the wiki.
719 2. Those needing more detailed function sets for their bibliographies may need
720 customized tools to provide those services. This is a basic tool that should
721 work for most people. Reference librarians will probably not be satisfied
725 To use citations in MultiMarkdown, you use a syntax much like that for
728 This is a statement that should be attributed to
729 its source[p. 23][#Doe:2006].
731 And following is the description of the reference to be
732 used in the bibliography.
734 [#Doe:2006]: John Doe. *Some Big Fancy Book*. Vanity Press, 2006.
736 The XHTML that is generated is as follows:
738 <p>This is a statement that should be attributed to its source
739 <span class="markdowncitation"> (<a href="#Doe:2006">1</a>, <span
740 class="locator">p. 23</span>)</span>.</p>
742 <p>And following is the description of the reference to be used
743 in the bibliography.</p>
745 <div class="bibliography">
749 <div id="Doe:2006"><p>[1] John Doe. <em>Some Big Fancy Book</em>.
750 Vanity Press, 2006.</p></div>
754 You are not required to use a locator (e.g. `p. 23`), and there are no special
755 rules on what can be used as a locator if you choose to use one.
757 There are no rules on the citation key format that you use (e.g. `Doe:2006`),
758 but it must be preceded by a `#`, just like footnotes use `^`.
760 As for the reference description, you can use Markup code within this section,
761 and I recommend leaving a blank line afterwards to prevent concatenation of
762 several references. Note that there is no way to reformat these references in
763 different bibliography styles; for this you need a program designed for that
764 purpose (e.g. BibTeX).
766 If you want to include a source in your bibliography that was not cited, you
767 may use the following:
769 [Not cited][#citekey]
771 The `Not cited` bit is not case sensitive.
774 ### MultiMarkdown References ###
776 If you define your references (as in the example above), MultiMarkdown will
777 automatically append a basic bibliography to the end of your document. The
778 citations will of the form:
780 <span class="markdowncitation"> (<a href="#citekey">#
781 </a>, <span class="locator">p. 23</span>)</span>
783 If you don't define a locator, you will get:
785 <span class="markdowncitation"> (<a href="#citekey">#
788 When you click on the `#` (which is replaced with the specific reference
789 number), it takes you to the appropriate point in the Bibliography. Unlike
790 footnotes, there is no reverse link.
793 ### External References ###
795 If you do not define references, then MultiMarkdown will substitute different
796 markup that can be used by XSLT to transform it into markup for an external
799 <span class="externalcitation"> (<a id="citekey">citekey</a>, <span
800 class="locator">p. 23</span>)</span>
802 If you don't define a locator, you will get:
804 <span class="externalcitation"> (<a id="citekey">citekey</a>)</span>
807 Obviously, the citekey that you use in MultiMarkdown must match that used by
810 [MultiMarkdownDragAndDrop]: http://fletcherpenney.net/Applications_That_Support_MultiMarkdown#multimarkdowndraganddrop "MultiMarkdown Drag and Drop"
812 ### Multiple Citations ###
814 When you need to combine multiple citations together, simply add them
817 [p. 3][#Doe:1996][p. 10][#Smith:2005]
823 I recognize that this is not really a standardized format, but again I remind
824 you that the bibliography support in MultiMarkdown is minimal. If you want
825 more control, or adherence to proper style rules, you need a more powerful
828 I have written a perl script that will join these serial citations into one,
829 `cleancites.pl`. It is run by default by the default MultiMarkdown usage
832 ### BibTeX Support ###
834 If you are a user of BibTeX, you may use it to control your references. Simply
835 set the `Bibtex` and `Bibliographystyle` metadata as described in the section
836 on [Metadata][], and use my xhtml2latex XSLT files as examples.
838 If you use this, you are not required to define your references within your
839 MultiMarkdown document.
841 ### Advanced Citations with natbib ###
843 Advanced LaTeX users are probably familiar with the
844 [natbib](http://www.ctan.org/tex-archive/help/Catalogue/entries/natbib.html)
845 package, which adds additional features for bibliographic citations. It offers
846 two new citation commands, `\citet` and `\citep`.
848 To use the advanced natbib features:
850 1. You must have the natbib package installed for LaTeX
851 2. You must use an appropriate XSLT file that enables the natbib package (`memoir-natbib.xslt` is an example - you can make your own)
854 By default, citations occur using the `\citep` command.
856 To use a `\citet` citation, follow the example below:
858 In their seminal paper, [Smith and Jones; p 42][#Smith1990] argue
859 convincingly that....
861 [#Smith1990]: Smith, R, and Jones, K. *Some Fancy Article* etc...
863 The text before the semi-colon indicates that we want a textual citation. In
864 the XHTML version, the text you enter becomes the text in the sentence. When
865 converted to LaTeX, your text is actually removed and the natbib package
866 handles it for you. The text after the semi-colon is the usual locator text
867 (if you don't want a locator, just leave it blank after the semi-colon).
869 If you don't include a semi-colon, then the `\citep` command is used in the
874 ### Introduction to Math support ###
877 **Note**: *Math support within MultiMarkdown is created using MathML. MathML
878 is not fully supported in many browsers, so your mileage may vary (I honestly
879 don't care whether Internet Explorer works --- get a real browser. Support
880 within Firefox is pretty good, but not perfect.) This feature is quite useful,
881 however, when generating a PDF via LaTeX.*
883 *To view a file with MathML properly in Firefox, it must have the file ending
884 ".xhtml". I don't know why, and it seems dumb that file extensions are so
885 important in 2007. But for now, that's the way it is.*
887 MultiMarkdown supports [ASCIIMathML](http://en.wikipedia.org/wiki/ASCIIMathML)
888 a syntax for converting mathematical equations from plain text into
889 [MathML](http://en.wikipedia.org/wiki/MathML). MathML can be used within
890 properly formatted XHTML documents to display well typeset mathematical
893 The conversion used to managed by
894 [ASCIIMathPHP](http://www.jcphysics.com/ASCIIMath/), which was a PHP script
895 that had to be run separately from MultiMarkdown itself. As of version
896 2.0b.b4, however, I am using the
897 [Text::ASCIIMathML](http://search.cpan.org/~nodine/Text-ASCIIMathML-0.5/) Perl
898 module for support built into the MultiMarkdown script.
900 ### MultiMarkdown Math Syntax ###
902 Basically, use use `<<` and `>>` as delimiters to indicate that you are
903 including math in your document. You can use this to create an inline formula,
904 or you can create independent equations, each in it's own paragraph. These can
905 also then be converted properly into LaTeX math environments.
907 Additionally, you can include a `[label]` tag at the end of the equation to
908 allow you to reference it elsewhere in your text with the label. For example:
910 << e^(i pi) + 1 = 0 [Euler's identity]>>
912 << x_(1,2) = (-b+-sqrt(b^2-4ac))/(2a) [quadratic equation solution]>>
914 You can also include formulas within a sentence, such as
915 <<x^2 + y^2 = 1>>. You can then make a reference to
920 > << e^(i pi) + 1 = 0 [Euler's identity]>>
922 > << x_(1,2) = (-b+-sqrt(b^2-4ac))/(2a) [quadratic equation solution]>>
924 > You can also include formulas within a sentence, such as
925 > << x^2 + y^2 = 1>>. You can then make a reference to [Euler's identity].
929 By using the math mode above, you can include superscripts and the like in
930 MultiMarkdown documents that don't necessarily have to be separate formulas.
939 This is, of course, subject to the same limitations as MathML in general.
941 ### MathML Difficulties ###
943 There are some glitches in this process. First, many browsers don't fully
944 support MathML, and sometimes you have to go through great lengths to get the
945 browser to recognize it properly. Firefox, for instance, requires an `.xhtml`
946 extension to properly recognize the file as `XHTML` instead of `HTML`. This
947 may not be an ideal solution for everybody, but it **does** allow you to use a
948 plain english syntax to represent mathematical formulas and symbols within
949 Markdown documents, which was my goal. Others may prefer to use custom
950 solutions using raw LaTeX source, but I didn't want to have to learn the LaTeX
953 On the up side, however, this does give wonderful output when combined with my
954 XSLT scripts to generate LaTeX documents and PDF's. I am open to input on this
955 feature, and suspect it will become increasingly useful as browser support for
958 For more information on supporting MathML in web browsers, I have written a
959 brief introduction to
960 [Supporting MathML](http://fletcherpenney.net/Supporting_MathML) on my web
964 ## Definition Lists ##
966 MultiMarkdown has support for definition lists using the same syntax used in
967 [PHP Markdown Extra][]. Specifically:
970 : Pomaceous fruit of plants of the genus Malus in
972 : An american computer company.
975 : The fruit of an evergreen tree of the genus Citrus.
981 > : Pomaceous fruit of plants of the genus Malus in
982 > the family Rosaceae.
983 > : An american computer company.
986 > : The fruit of an evergreen tree of the genus Citrus.
988 You can have more than one term per definition by placing each term on a
989 separate line. Each definition starts with a colon, and you can have more than
990 one definition per term. You may optionally have a blank line between the last
991 term and the first definition.
993 Definitions may contain other block level elements, such as lists,
994 blockquotes, or other definition lists.
996 Unlike PHP Markdown Extra, all definitions are wrapped in `<p>` tags. First, I
997 was unable to get Markdown *not* to create paragraphs. Second, I didn't see
998 where it mattered - the only difference seems to be aesthetic, and I actually
999 prefer the `<p>` tags in place. Let me know if this is a problem.
1001 See the [PHP Markdown Extra][] page for more information.
1005 If you want to designate the final subgroup of chapters as appendices, you can include an `h1` or `h2` level header (as appropriate based on your document) with the title `Appendices`. The chapters that follow would be considered appendices when the document is converted to LaTeX using the memoir class. Since XHTML doesn't have a concept of appendices, it has no real meaning, but would at least designate this to the reader.
1009 MultiMarkdown has a feature that allows footnotes to be specified as glossary
1010 terms. It doesn't do much for XHTML documents, but the XSLT file that converts
1011 the document into LaTeX is designed to convert these special footnotes into
1014 The glossary format for the footnotes is:
1016 [^glossaryfootnote]: glossary: term (optional sort key)
1017 The actual definition belongs on a new line, and can continue on
1018 just as other footnotes.
1020 The `term` is the item that belongs in the glossary. The `sort key` is
1021 optional, and is used to specify that the term should appear somewhere else in
1022 the glossary (which is sorted in alphabetical order).
1024 Unfortunately, it takes an extra step to generate the glossary when creating a
1025 pdf from a latex file:
1027 1. You need to have the `basic.gst` file installed, which comes with the
1030 2. You need to run a special makeindex command to generate the `.glo` file:
1031 ``makeindex -s `kpsewhich basic.gst` -o "filename.gls" "filename.glo"``
1033 3. Then you run the usual pdflatex command again a few times.
1035 Alternatively, you can use the code below to create an engine file for TeXShop
1036 (it belongs in `~/Library/TeXShop/Engines`). You can name it something like
1037 `MemoirGlossary.engine`. Then, when processing a file that needs a glossary,
1038 you typeset your document once with this engine, and then continue to process
1039 it normally with the usual LaTeX engine. Your glossary should be compiled
1040 appropriately. If you use [TeXShop][], this is the way to go.
1042 **Note**: *Getting glossaries to work is a slightly more advanced LaTeX
1043 feature, and might take some trial and error the first few times.*
1048 set path = ($path /usr/local/teTeX/bin/powerpc-apple-darwin-current
1049 /usr/local/bin) # This is actually a continuation of the line above
1051 set basefile = `basename "$1" .tex`
1053 makeindex -s `kpsewhich basic.gst` -o "${basefile}.gls" "${basefile}.glo"
1056 [TeXShop]: http://www.uoregon.edu/~koch/texshop/ "TeXShop Homepage"
1060 By default, when you have a section of text indented with a tab, MultiMarkdown
1061 interprets this as a code block. This allows you to more exactly control the
1062 spacing and line endings, but it also applies a monospace font in both the
1063 XHTML and LaTeX outputs. This is the usual way of demonstrating source code in
1066 Some authors, however, don't write about source code, but would like a way to
1067 control line endings (when writing poetry, for example).
1069 To accomplish this, there are several alternate XSLT files included within the
1070 MultiMarkdown distribution that are labelled with a `poetry` filename. These
1071 XSLT files handle the code blocks in a slightly different way to make them
1072 more suitable for text, rather than code. I encourage you to give this a try.
1074 At the current time, there is no way to use both formats within the same
1075 document, except to format them manually. This may change in the future,
1076 depending on some decisions John Gruber needs to make about the standard
1081 In addition to what is mentioned elsewhere in this document, MultiMarkdown
1082 does a few things slightly differently:
1084 * `©` entities are converted to `©` so that they can pass through an
1087 * `*` and `_` are not interpreted as `<strong>` or `<em>` when they occur in
1088 the middle of words. This caused too many problems with URL's.
1090 MultiMarkdown supports the conversion of colored spans of text from XHTML to
1091 LaTeX using the xcolor package. For example:
1093 <span style="color:#888888">net</span>
1097 {\color[HTML]{888888} net}
1099 There is not currently a syntax shortcut for this, you have to manually add
1100 the `<span>` information. This technique is used to support annotations from
1101 Scrivener, for example.
1103 [PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
1105 # MultiMarkdown and LaTeX #
1107 [LaTeX](http://www.latex-project.org/) is a professional quality typesetting
1108 system that can be used to take plain text markup and produce a high quality
1109 pdf, complete with table of contents, index, glosssary, etc. It's a fairly
1110 complicated program, but capable of doing most of the work for you. One of my
1111 goals with MultiMarkdown was to make it even easier to create a LaTeX
1112 document, with minimal knowledge of the LaTeX syntax. In fact, you can create
1113 fairly complex documents without any understanding of how LaTeX works, as long
1114 as you have it installed correctly.
1117 That said, MultiMarkdown is not simply a preprocessor for LaTeX files, so
1118 there will always be LaTeX commands that are just not available from within
1119 MultiMarkdown. If you're a LaTeX expert, you might find that after
1120 MultiMarkdown runs, you want to go and hand tweak a few parts to get things
1121 just right. But for the average user and average document, I suspect the
1122 default output will be just fine.
1124 The settings to pay particular attention to:
1126 * You must choose an XSLT file to convert the MultiMarkdown-generated XHTML
1127 into LaTeX; you do this by setting the `LaTeX XSLT` metadata. If you do not
1128 choose one, the default is `memoir.xslt`. Most of my XSLT files are based
1129 around the `memoir` package --- it's the one I'm familiar with, it's very
1130 flexible, and has high quality output, and lots of features. That said, you
1131 are welcome to create your own XSLT files to use whatever packages you
1132 prefer. The beauty of the XSLT transformation process is that it can be
1133 completely reconfigured however you like.
1135 * Depending on what sort of document you are creating, you may need to set the
1136 `Base Header Level` metadata. For example, if you are creating a `memoir`
1137 based document, and wish for your top-level section to be a chapter, rather
1138 than a "part", you could set `Base Header Level` to 2. It's easier to do
1139 than explain, but basically it moves all levels of your structure by the
1140 specified number of steps.
1142 * You likely will want to set as much of the basic metadata as possible (e.g.
1143 `Title`, `Author`, `Date`, `Keywords`, etc) as most of this is converted to
1144 a format that is used in the resulting PDF.
1146 Also, MultiMarkdown has support for
1147 [BibTeX](http://en.wikipedia.org/wiki/BibTeX), glossaries, html links,
1148 internal links between sections of the document, math formatting, etc. Most of
1149 the "major" features of LaTeX are available using the standard MultiMarkdown
1150 syntaxes. If there is something you don't see, just ask --- it may exist, or I
1151 might be able to add it if appropriate.
1153 The general process of creating a PDF via LaTeX is the same as the normal use
1154 of MultiMarkdown, with one additional step:
1156 1. Create your text source file
1158 2. Using your method of choice, convert the text file to XHTML, and then
1159 convert the XHTML to LaTeX (most of my tools will do this as a single step as
1160 far as the user is concerned).
1162 3. Convert the LaTeX source file to PDF using the tool of your choice (my Drag
1163 and Drop [application](http://fletcherpenney.net/MultiMarkdown_Drag_and_Drop),
1164 [TeXShop], [latexmk](http://www.phys.psu.edu/~collins/software/latexmk-jcc/),
1167 Due to the complexity of the LaTeX source, it can be hard to troubleshoot when
1168 using an automatic tool. If something doesn't work, I recommend first trying
1169 to get your MultiMarkdown text file converted to XHTML and verify that it is
1170 correct. Then convert the XHTML to LaTeX and be sure that you can watch the
1171 status messages that occur during processing of the LaTeX file - they will
1172 usually give you a hint as to where the problem lies. Remember, just because
1173 the XHTML version of a MultiMarkdown document is valid XHTML does not mean the
1174 resulting LaTeX will be totally valid.
1176 [TeXShop]: http://www.uoregon.edu/~koch/texshop/ "TeXShop Homepage"
1178 # Advanced Features and Customization #
1180 I believe that MultiMarkdown works pretty well "out of the box" for the vast
1181 majority of users (of course, I'm not biased or anything...) But more advanced
1182 users will eventually start thinking about features that they wish existed.
1183 Some of these features are very specific to their own documents and style, but
1184 others are more general and would be of use to everyone.
1186 ## How do I find out about feature x? ##
1188 My recommended approach is:
1190 1. Make sure you check through the documentation on the web site (there is a
1191 search feature). An increasing number of feature requests are for things that
1194 2. Check the MultiMarkdown discussion list to see if someone has already
1195 suggested your feature, or better yet, has already solved it.
1197 3. Decide whether it's something you could try and do yourself, or whether you
1198 need to ask for help to accomplish it. Either way, the results can be shared
1199 on my web site to help others.
1201 ## How do I customize MultiMarkdown? ##
1203 The first step in trying to customize MultiMarkdown is to figure out where in
1204 the workflow the customization needs to occur:
1206 1. Does the MultiMarkdown perl script need to be modified to add a new syntax,
1207 or change the way the output is generated? There should be fewer and fewer
1208 necessary changes in this step as the MultiMarkdown syntax matures. Also, note
1209 that I am hesitant to add new features at this level that increase the
1210 complexity of markup. It's not impossible, but I will definitely need to be
1211 convinced it's the only way to go.
1213 2. Can the desired feature be implemented through a modification of one of the
1214 XSLT files? XSLT is a powerful tool, and can be used to really customize the
1215 XHTML or LaTeX output from a MMD document. (*Many users would likely benefit
1216 from a generic XHTML to RTF XSLT stylesheet - I have been unable to locate one
1217 that would work, and I have no need of RTF documents. This would be too much
1218 work for too little gain for me, but I am sure someone out there needs exactly
1219 this sort of tool.*) Browse through the `XSLT` directory and look to see if
1220 there is a stylesheet that could be modified to do what you want. The XSLT
1221 syntax is not that complicated, but does take some getting used to. As
1222 examples, the `xhtml-toc.xslt` script parses the header tags in the XHTML
1223 output, and creates an automatic table of contents at the top of the XHTML
1224 file. The `xhtml-poetry-support.xslt` file looks for code blocks that start
1225 with `[poetry]` and changes them to a poetry mode, rather than code (basically
1226 removing the monospace font).
1228 3. Does the desired feature need to be implemented in a separate
1229 post-processing script? For example, for LaTeX documents I use a script called
1230 `cleancites.pl` that looks for strings of multiple citations to shorten the
1231 syntax. You could easily create a script to do whatever you like and
1232 incorporate it into your work flow.
1235 In summary, a great many features and customizations can be added to
1236 MultiMarkdown by users. I also recommend that you consider sharing any of your
1237 customizations back to the MultiMarkdown community - I am happy to put any
1238 files or links on my site, if you are interested.
1240 ## Where do I dig in the MultiMarkdown package to find out more? ##
1243 Again, places to look for inspiration:
1245 * MultiMarkdown/bin - this is where the "glue" scripts live that manage
1246 different MultiMarkdown workflow patterns. You can create your own shell
1247 scripts that can add additional steps to your workflow here.
1249 * MultiMarkdown/Utilities - a couple of utility scripts and the
1250 `cleancites.pl` post-processing script live here; you can add files here and
1251 incorporate them into your work flow.
1253 * MultiMarkdown/XSLT - XSLT files for modifying XHTML files or creating LaTeX
1254 files go here. Lots of examples for different styles of output or
1255 customizing the way various features work.
1257 * <http://fletcherpenney.net/XSLT_Files> - this is where I will place various
1258 user submitted files that may be of interest, or offer a starting point for
1259 further customization. Please consider submitting your own improvements here
1262 # Component Software #
1264 The MultiMarkdown system is actually a patchwork of multiple programs, which
1265 are run in a specific order by shell scripts. I have written the glue
1266 utilities, and the MultiMarkdown modifications to John Gruber's original
1267 Markdown program, but I can't take credit for the rest.
1270 ## MultiMarkdown [MMD] ##
1272 * by Fletcher T. Penney
1273 * <http://fletcherpenney.net/MultiMarkdown>
1275 MultiMarkdown is my update to John Gruber's
1276 [Markdown](http://daringfireball.net/projects/markdown/) software. It is what
1277 this bundle is based on. To learn more about why you would want to use this
1278 bundle, check out the web page for MultiMarkdown.
1283 * <http://daringfireball.net/projects/smartypants/>
1285 SmartyPants is another program by John Gruber, and is designed to add "smart"
1286 typography to HTML documents, including proper quotes, dashes, and ellipses.
1287 Additionally, there are several variations of the SmartyPants files to handle
1288 different localizations (specifically, Dutch, French, German, and Swedish).
1289 These localizations were provided by Joakim Hertze.
1291 ## Text::ASCIIMathML ##
1294 * <http://search.cpan.org/~nodine/>
1296 This perl module adds support for converting the ASCIIMathML syntax into
1297 MathML markup suitable for inclusion in XHTML documents.
1299 ## ASCIIMathPHP (Deprecated)##
1301 * by Kee-Lin Steven Chan
1302 * <http://www.jcphysics.com/ASCIIMath/>
1304 This bundle includes the MultiMarkdown specific variant of the original
1305 ASCIIMathPHP. It allows you to use the ASCIIMath syntax to describe
1306 mathematical formulas in plain text language.
1308 This software has been replaced by Text::ASCIIMathML.
1312 * by Vasil Yaroshevich
1313 * <http://www.raleigh.ru/MathML/mmltex/index.php?lang=en>
1315 This bundle includes the MultiMarkdown specific variant of the original
1316 XSLTMathML. It converts XHTML with MathML markup into LaTeX math environment
1317 code. Very handy for making well typeset documents that are math-heavy.
1319 # Applications That Support MultiMarkdown #
1321 There are several applications and utilities out there that include support
1322 for MultiMarkdown, that can make it even easier to create your output
1325 If you know of something not included here, please let me know.
1327 ## MultiMarkdown Drag and Drop ##
1329 Early on, as MultiMarkdown became increasingly powerful (and complex) I
1330 realized that most people would want something a little easier to use than
1331 what had become a rather complicated command line string.
1333 The first solution was a set of Drag and Drop applications created using
1334 [Platypus]. These were designed to allow you to drop a MultiMarkdown text file
1335 on the application icon, and they spit out a .xhtml, .pdf, .rtf, or .tex file,
1336 depending on which application you used.
1338 These utilities are still available, and have been updated to work with the
1339 "Common" MultiMarkdown Installation:
1341 * <http://files.fletcherpenney.net/MultiMarkdownDragAndDrop.zip>
1344 [Platypus]: http://sveinbjorn.sytes.net/platypus "Platypus Homepage"
1350 > ... project management tool for writers that acts like your own
1351 > little writing shed at the bottom of the garden, where you have
1352 > cork notice-boards, ring-binders, photos, clippings paperclipped
1353 > to jottings, notebooks and reams of typewritten pages piling up
1354 > - along with a secretary who keeps it all in neat piles and uses
1355 > his speed-reading skills to find what you need as soon as you need
1358 As of beta 3, Scrivener has the ability to export to a MultiMarkdown text
1359 file, or to run the conversion utilities to create XHTML, RTF, or LaTeX files.
1360 It also has support for MultiMarkdown metadata.
1362 Scrivener's strengths, as they relate to MultiMarkdown, included the ability
1363 to arrange and re-arrange your document as desired using its outliner view,
1364 cork-board, and other features. It also has some limited ability to convert
1365 RTF bold and italic formatting into MultiMarkdown syntax, which can be useful
1366 when converting documents from other formats.
1368 Scrivener is primarily focused towards creative writing, but when combined
1369 with MultiMarkdown it is very useful for academic and technical writing where
1370 a LaTeX file is highly desirable.
1372 Keith Blount has done a great job with Scrivener, and I was happy to be able
1373 to help implement support for MultiMarkdown. I look forward to helping to
1374 continue to use and refine this program myself.
1376 At this time, Scrivener is in public beta, and should be available for
1377 purchase towards the end of 2006 or beginning of 2007. But the beta is very
1378 usable as is, and gives you until Jan 2007 or so to try it out.
1380 For more information, I have created a User's Guide to MultiMarkdown and
1383 * <http://fletcherpenney.net/Using_MultiMarkdown_with_Scrivener>
1385 [#Blount]: Literate and Latte - Scrivener.
1386 <http://www.literatureandlatte.com/scrivener.html>
1390 [TextMate][] is a powerful text editor that:
1392 > brings Apple's approach to operating systems into the world of text
1393 > editors. By bridging UNIX underpinnings and GUI, TextMate cherry-picks
1394 > the best of both worlds to the benefit of expert scripters and novice
1397 > Created by a closet UNIX geek who was lured to the Mac platform by
1398 > its ease of use and elegance, TextMate has been referred to as the
1399 > culmination of Emacs and OS X and has resulted in countless requests
1400 > for both a Windows and Linux port, but TextMate remains exclusive for
1401 > the Mac, and that is how we like it![#macromates][]
1403 TextMate is somewhere between a text editor for programmers, and a writing
1404 tool. If you like being able to customize your writing environment, and like
1405 fancy tools to handle the formatting for you, then TextMate might be the app
1408 Allan Odgaard created an initial Bundle that added Markdown support to
1409 TextMate. It included some basic MultiMarkdown support as well. But to be
1410 honest, *I* had trouble getting it to work. And if I had difficulty, I can
1411 only imagine how much trouble others had.
1413 So I created my own Bundle. It includes a lot of features that automatically
1414 format metadata, lists, tables, headers, etc. It can clean up the text to make
1415 it look as presentable as possible in plain text, and it can then
1416 automatically convert your text into XHTML, RTF, Word, or LaTeX/PDF.
1418 My TextMate Bundle is available on my web site:
1420 * <http://fletcher.freeshell.org/wiki/MultiMarkdownTextMateBundle>
1422 It is designed to play nicely with the default Markdown Bundle, so you can
1423 have them both installed. You may wish to disable a few features from the
1424 original bundle, but that is totally up to you.
1428 [#macromates]: TextMate --- The Missing Editor for Mac OS X.
1429 <http://macromates.com/>
1432 ## Using Scrivener and TextMate Together ##
1434 It is possible, using the "Edit in TextMate" feature from TextMate. Basically,
1435 it adds the ability to edit any Cocoa based text editor view in TextMate. This
1436 allows you to edit the text from a Scrivener document in TextMate, in order to
1437 take advantage of the automatic formatting, while still retaining the
1438 organizational features of Scrivener.
1440 This feature has its limitations (it breaks the undo stack in Scrivener) and
1441 is only for advanced users. I take no responsibility for it, as I didn't write
1442 Scrivener or TextMate. But it can be useful...
1444 To learn more, check out the information on Cocoa Text Fields:
1446 * <http://macromates.com/textmate/manual/using_textmate_from_terminal>
1448 ## The "Common" MultiMarkdown approach ##
1450 During beta testing of the MultiMarkdown support with Scrivener, it was
1451 proposed that having a standard location for MultiMarkdown could make it easy
1452 to integrate with various applications, and to allow the user a single place
1453 to update their MultiMarkdown files, independent of the application it was
1456 For Mac OS X users, this boils down to allowing a MultiMarkdown installation
1457 to be placed in one of two locations, where it is available to any application
1458 that knows to look for it there:
1460 * ~/Library/Application Support/MultiMarkdown
1462 * /Library/Application Support/MultiMarkdown
1464 The first is available only to the user, and the second is available to anyone
1467 When Scrivener, or another application that supports this feature is run, it
1468 checks to see if a MultiMarkdown installation is available in either of those
1469 places. If not (the first time you run the program, for instance), then some
1470 programs might install a version of MultiMarkdown here; others might simply
1471 use an a copy of MultiMarkdown embedded within the application bundle.
1473 The benefit of this approach is that if I update MultiMarkdown, you can simply
1474 replace the updated files in the Application Support folder, without having to
1475 update the other applications.
1477 Please let me know if you have suggestions on improving this feature, or if
1478 you are interested in including support for MultiMarkdown in your own
1481 Naturally, this approach only works with Mac OS X. If anyone is interested in
1482 working on a similar feature for other operating systems, please let me know.
1484 ## Create Your Own ##
1486 Between shell scripts, applescripting, Automator, and other tools, you can
1487 usually find an easy way to incorporate MultiMarkdown into your own workflow.
1488 If you find something that you think should be added here, let me know!
1491 # Technical Issues #
1493 The MultiMarkdown system is actually a fairly complex group of programs, which
1494 includes multiple perl utilities, a PHP program, and multiple XSLT files. With
1495 some hand waving, I try to make it look like a single coherent program, but it
1496 actually uses multiple utilities written by multiple people.
1498 This section is designed to address some of these issues, and implications
1499 they may have for users, programmers, etc.
1502 ## XML Namespace Issues ##
1504 As of version 2.0.a3, there has been a complete overhaul of the way XML
1505 namespaces are handled. This required changing all of the XSLT files to use an
1506 "html" alias for the "http://www.w3.org/1999/xhtml" namespace.
1508 It appears to be working, including support for MathML.
1510 If you have any custom XSLT files, you will need to make the same changes,
1513 Make your stylesheet declaration look like:
1516 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1517 xmlns:html="http://www.w3.org/1999/xhtml"
1520 And relabel any references to XHTML elements, so that they are preceeded by "html:", e.g.
1522 <xsl:template match="/">
1523 <xsl:apply-templates select="html/head"/>
1524 <xsl:apply-templates select="html/body"/>
1525 <xsl:call-template name="latex-footer"/>
1528 should look like this:
1530 <xsl:template match="/">
1531 <xsl:apply-templates select="html:html/html:head"/>
1532 <xsl:apply-templates select="html:html/html:body"/>
1533 <xsl:call-template name="latex-footer"/>
1536 I have left the `-novalid` and `-nonet` options in place to prevent
1537 unnecessary errors when you are not connected to the internet, but these could
1538 be removed if desired.
1542 If you are using XeLaTeX to process your document (useful for utilizing Mac OS X fonts in your document), you want to use font declarations like this:
1544 \font\addressbold="Garamond Bold:mapping=tex-text" at 8pt
1546 By including the ":mapping=tex-text" portion, you regain use of smart quotes, en- and em- dashes, etc. I'm sure most XeLaTeX users know this, but it took me a bit of trial and error to discover it....
1551 Thanks to the individuals and groups below for their contributions to
1552 improving Markdown and MultiMarkdown:
1575 * Kee-Lin Steven Chan
1588 and others I have surely forgotten....
1592 * The `<<...>>` syntax can cause only the first `<` to be encoded as `<` if
1593 there is no trailing space (e.g. `<<something>>` vs. `<< something >>`). I
1594 suspect that I will have to manually look for any `<<` and convert them. I
1595 guess this is technically an issue with Markdown and not MultiMarkdown, but
1596 it has apparently not come up before.
1598 * I tried to remove dependence on the `varwidth` package. This screws up the
1599 formatting of footnotes in tables, and also RTF exporting of tables. I'm not
1600 sure what to do - varwidth is incompatible with xcolor and is not a standard
1601 package. Suggestions welcome.
1603 * You need to use the newest version of xsltproc if you want to make best use
1604 of the XSLT features (such as LaTeX formatting.) The version Apple includes
1605 does not support the `last()` function and can cause problems.
1607 * Creating a link to an image by label doesn't work properly anymore
1609 * I'm having difficulty with getting the glossary feature to work in the
1610 non-memoir classes. At some point I will look into this, but if someone else
1611 out there can point out what I'm doing wrong, let me know.
1613 * RTF support currently only exists for Mac OS X. Conversion from XHTML to RTF
1614 happens via Apples `textutil` tool. It is possible to write an XSLT file
1615 that converts from XHTML to RTF, but I have little to no interest in writing
1616 this myself, as I don't really use the RTF format very often. If someone
1617 were interested in developing this, I would help out. An added benefit would
1618 be that the XSLT could actually do a better job than Apple's tool in terms
1619 of footnote support and internal links. Contact me if you're interested.
1621 * The sample MMD file creates two copies of the footnote in the `MultiMarkdown
1622 vs. Crayons` table, even though I only call for one. Not sure where the `a`
1623 footnote comes from.... Any help in tracking this down would be appreciated,
1624 as it didn't used to do this.
1628 * Add a syntax to allow comments that can be stripped before passing the
1629 output to the parser
1631 * write a routine (that would be separate from MultiMarkdown) to download
1632 linked images, save them to a tmp directory, and then convert them for use
1635 * Consider adding the ability to only convert the first instance of a
1636 `WikiWord` or `[[Free Link]]`, rather than each instance. I suppose this
1637 would have to be grouped by level, however, which would complicate
1640 * Decide on appropriate management of alignment when a cell spans multiple
1641 columns. Currently, the alignment of the first cell is used. (If Markdown
1642 goes to a whitespace-based alignment option, that could be used in this
1645 * Consider whether there is a reasonable syntax for table cells that span
1648 * Consider a syntax for superscripts (this has been discussed before) - could
1649 convert it to MathML syntax? Or just use math markup instead as described in
1652 * Certain markup gets processed within headers and shouldn't, e.g. `<img>`
1654 * Consider whether to incorporate the definition list syntax into a footnote
1655 to specify a glossary entry (or perhaps even without the footnote), or
1656 whether to leave well enough alone.
1660 > Release early, release often!
1663 * 2.0.b5 - spaces at end of xslt filenames won't cause failure; use `\url{}`
1664 for "non-referenced" url's in LaTeX to allow linebreaks (though they still
1665 don't always break correctly --- this is a problem with `hyperref` not MMD);
1666 don't convert `^` to exponents in the `clean-text-allow-latex.xslt` file so
1667 that math code works properly; the S5 XSLT file at least partially works
1668 again now; update the TextMate bundle to work with Leopard; updated the
1669 envelope and letterhead files; include `6x9book-real-poetry` XSLT that uses
1670 memoir's poetry features fairly well; rework the `clean-text` files to make
1671 them easier to update in the future and more modular; XHTML comments are now
1672 passed through as raw LaTeX; unescape encoding within comments;
1674 * 2.0.b4 - empty labels for headers now produce valid XHTML (e.g. no `id=""`);
1675 fix bug in `clean-text.xslt` that caused a problem with closing double
1676 quotes; the `.xslt` extension is no longer required in metadata; added
1677 customizable letterhead XSLT; fix bug in table support that choked on extra
1678 spaces at end of lines; *Major Change*: switched to Text::ASCIIMathML for
1679 math support, meaning that everything is once again perl based (this enables
1680 math features on web sites using MultiMarkdown, for example); fix bug that
1681 occurred when 'Abstract' was not the first chapter;
1683 * 2.0.b3 - move the `clean-text` routine from `xhtml2latex.xslt` into it's own
1684 file (to allow easier modification by users); create alternate version that
1685 does not protect certain characters in order to allow raw LaTeX code to be
1686 passed through; added `latex-snippet.xslt` stylesheet for inclusion in
1687 outside LaTeX template systems; added `xhtml-poetry-support.xslt` and
1688 `xhtml-toc.xslt` to demonstrate how to extend MMD functionality for XHTML
1689 output with new system; fix bug in SmartyPants that processed typography
1690 within `<style>` sections (thanks AmberV); fix handling of links by
1691 reference in headers and handling of attributes when links are referenced
1692 multiple times (thanks to Edward Nixon); fix bug in epigraphs (thanks
1693 etherean); improve id generation for footnotes - e.g. match behavior of PHP
1694 Markdown Extra (thanks to Özgür Gökmen); fix bug in id generation for ToC
1695 for XHTML documents; fix problem with `\ldots` command (thanks to etherean
1696 and James Howison); fix issue with ` ` and tilde character; fix bug
1697 where footnote special characters were not unescaped (thanks to Chad
1698 Schmidt); clean up documentation a bit;
1700 * 2.0.b2 - fix processing of footnotes so that ending in a blockquote doesn't
1701 break validity; fix bug in `letter.xslt`; overhaul XSLT system to allow for
1702 different XSLT files for different output formats (e.g. HTML, RTF, LaTeX);
1704 * 2.0.b1 - fix bug in `_StripLinkDefinitions` that prevented detection of
1705 single character labels; change `\textwidth` to `\linewidth` in LaTeX export
1706 XSLT files (let me know if this causes problems); add Windoze compatibility
1707 to the perl scripts (thanks to Jason Bandlow for pointing out this problem,
1708 as well as for suggesting a fix);fix issues with glossary support and
1709 document the process; complete overhaul of the way namespaces are handled
1710 (`stripnamespace.pl` is no longer needed, XSLT files are rewritten, `-nonet`
1711 and `-novalid` should be optional for xsltproc); update the Drag and Drop
1712 applications to use the "Common" MMD Installation; update to Markdown
1713 1.0.2b8 codebase; add support for natbib and `\citep` and `\citet`;
1715 * 2.0.a2 - fix some minor problems with XSLTMathML; allow math to be enclosed
1716 in parentheses; change matching for bottomrule in tables; improve handling
1717 of tables with no header row (only a header column);
1719 * 2.0.a1 - strip spaces from metadata keys for XHTML validity; make XHTML
1720 footnote output more compatible with Gruber's website and PHP Markdown
1721 Extra; update XSLT to address these changes (*Note*: this breaks
1722 compatibility with prior versions); add support for definition lists; fix
1723 bug when escaping WikiWords in code; add `XHTML Header` metadata, and update
1724 XSLT to ignore `<style>` tags; add support for the `XSLT File` metadata tag,
1725 which allows a single command to parse any MultiMarkdown file; add
1726 additional XSLT files; add the multimarkdown2XHTML.pl and related commands;
1727 article XSLT now uses the article option in memoir, rather than the article
1728 class; delete the report class (use memoir instead); fix a **lot** of
1729 "minor" bugs; add the "6x9book.xslt" option; allow custom cross-reference
1730 labels to headers; give preference to defined links over automatic
1731 cross-references; add "poetry" versions of several XSLT files (treat code
1732 blocks as formatted text, rather than code --- useful for formatting poetry)
1734 * 2.0.a - New version numbering scheme; update to Markdown.pl 1.0.2b7 code;
1735 add support for `[link reference]` shortcut syntax (i.e. no trailing `[]`)
1736 for MultiMarkdown crossrefs; add an extra newline in verbatims to add space
1737 before the next paragraph; synchronize numbering schemes of all related
1738 MultiMarkdown tools to make it easier to ensure compatibility; add revision
1739 numbers to source documents to help track incompatibilities; add LaTeX
1740 support for `i.e.` and `e.g.`; TextMate MultiMarkdown bundle available;
1741 update MultiMarkdownDragAndDrop tools to new codebase; now distributed as a
1744 * 1.0.1Multi19.4 - major update; fix issue where cross-references to images
1745 defined by alt text had to follow the image in the document; add support for
1746 MathML via ASCIIMathPHP; change `name` to `id` for footnotes; move
1747 _DoHeaders in front of _DoTables to allow cross-references inside tables;
1748 fix handling of citations without locator; a table with no header titles and
1749 no column alignment row is interpreted as a pull-quote - this is
1750 experimental and may be changed; the `Bibliography Title` metadata field is
1751 available for LaTeX to rename the bibliography section; multiple changes to
1752 XSLT files to improve compatibility; support for `<< math >>` syntax using
1753 ASCIIMathPHP; change `HeaderLevel` to `Base Header Level` and process it in
1754 XSLT rather than in the OmniOutliner tool; support for `Affiliation`
1755 metadata element; add equation label to possible cross-reference list;
1756 compatible with epigraph feature for XSLT conversion to LaTeX; document
1757 table labeling feature and default to caption if no label present;
1759 * 1.0.1Multi19.2 - require leading space before unescaping \WikiWord; fixed
1760 bug where attributes not included with images; add `Bibliography Title`
1761 metadata key; fix bug with invalid leading characters in header id
1762 attributes; allow '-' and '_' in metadata; fix handling of citations in
1763 footnotes; fix issue with quotes in link attributes.
1765 * 1.0.1Multi19.1 - minor change to bibliography formatting to allow
1766 translation into a \BibTeX compatible format *without* the use of a `.bib`
1769 * 1.0.1Multi19 - Major update; fix bugs discovered by testing with
1770 MarkdownTest 1.0; don't add leading blank line if no metadata exists; fix
1771 parsing of link definitions, including attribute parsing; various clean- ups
1772 to code and documentation; improve cross-reference handling of special
1773 characters; fix bug in handling of wiki links (`/` is not automatically
1774 added any more); fix bug in `title` attributes of images; re-enable the
1775 inclusion of `DOCTYPE` in complete documents (this requires the use of the
1776 `-nonet` and `-novalid` options in xsltproc; fix bug in handling of `**`;
1777 fix bug where WikiWords in code blocks and spans were not unescaped; fix bug
1778 where digits were not allowed in metadata keys; fix numbering of footnotes
1779 so that they remain in proper order; add basic citation and bibliography
1780 features; major bug fixes and testing to precede the release of version 20
1783 * 1.0.1Multi18 - further work to make WikiWord escaping work properly...
1785 * 1.0.1Multi17 - add support for "char" alignment in table columns (**NOTE**:
1786 browsers do not currently support this); fix bug with `\` in code spans when
1787 WikiWords are disabled; fix bug in bold/italic detection
1789 * 1.0.1Multi16 - can now optionally have header in first cell of each row; fix
1790 bug in footnote counting (thanks to Mark Eli Kalderon for pointing this
1793 * 1.0.1Multi15 - allow for multiple `<tbody>` span's within a table; ensure
1794 that the variable`$g_empty_element_suffix` is used everywhere; protect code
1795 spans from table parsing
1797 * 1.0.1Multi14 - captions can now be before or after table; add syntax for
1798 column spanning within tables (body and header)
1800 * 1.0.1Multi13 - added support for CSS metadata key; allow no alignment option
1801 on table cells; support for captions for tables
1803 * 1.0.1Multi12 - added support for image/link attributes; fixed bug in table
1806 * 1.0.1Multi11 - added support for table syntax
1808 * 1.0.1Multi10 - allow emphasis at beginning of line
1810 * 1.0.1Multi9 - fix bug in metadata parsing
1812 * 1.0.1Multi8 - first draft of fix for "underscore within a word" problem that
1813 causes so many errors with URL's. Now a leading whitespace is required in
1814 front of the "opening" `_` or `*` for it to be interpreted as emphasis or
1817 * 1.0.1Multi7 - add Wiki Links support
1819 * 1.0.1Multi6 - correct bug in footnote id handling (Thanks to Jonathan Weber
1820 for pointing this out)
1822 * 1.0.1Multi5 - allow disabling of metadata feature
1824 * 1.0.1Multi4 - convert `©` entities to `©` (compatible with XSLT);
1825 generate cross-refs for images
1827 * 1.0.1Multi3 - fix metadata parsing in the event a key was empty
1829 * 1.0.1Multi2 - add support for footnotes. **Major** change - no longer use
1830 templates, but rather will focus on using XSLT to convert from XHTML output
1831 to other formats. I think this will be more flexible and less error prone.
1833 * 1.0.1M - initial release
1838 [Markdown]: http://daringfireball.net/projects/markdown/ "Markdown"
1839 [blosxom]: http://www.blosxom.com/ "Blosxom"
1840 [Oddmuse]: http://oddmuse.org/ "Oddmuse"